/*
Eteria IRC Client, an RFC 1459 compliant client program written in Java.
Copyright (C) 2000-2001  Javier Kohen <jkohen at tough.com>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

import java.awt.*;
import java.awt.event.*;
import java.net.MalformedURLException;
import java.net.URL;
import ar.com.jkohen.awt.ChatPanel;
import ar.com.jkohen.awt.MircSmileyTextArea;
import ar.com.jkohen.irc.Channel;
import ar.com.jkohen.util.Resources;
import com.splendid.awtchat.*;

public class HelpWindow extends OutputWindow
{	
	private EIRC eirc;
    private Resources res;
	private String title;

    public HelpWindow(EIRC eirc, String title)
	{
    	super(title);

    	this.eirc = eirc;
    	this.title = title;

		text_canvas.setMode(eirc.scrollSpeed());
		text_canvas.setFont(eirc.getFont());
		
    	GridBagLayout gb = new GridBagLayout();
    	GridBagConstraints gbc = new GridBagConstraints();

    	setLayout(gb);
    	gbc.insets = new Insets(2, 2, 2, 2);

      	gbc.weightx = 1.0;
    	gbc.gridwidth = GridBagConstraints.REMAINDER;

    	gbc.fill = GridBagConstraints.BOTH;
    	gbc.weighty = 1.0;
    	gb.setConstraints(text_canvas, gbc);
    	add(text_canvas);
    }

	public void clear()
	{
		text_canvas.clear();
	}
	
	public void home()
	{
		text_canvas.home();
	}

    public void append(String s)
    {
    	text_canvas.append(s);
    }

    public void handleHyperlink(String link)
    {
		if (Channel.isChannel(link))
		{
		    joinChannel(link);
 		}
 		else
 		{
	 	   try
	 	   {
				visitURL(new URL(link));
	 	   }
	 	   catch (MalformedURLException e)
	 	   {
				printError(res.getString("eirc.not_an_url"));
	 	   }
		}
    }
	
    protected void talkTo(String nick)
    {
    }
	
    protected void copyText(String text)
    {
    }
	
    protected void joinChannel(String name)
    {
		eirc.joinChannel(name);
    }
	
    protected void visitURL(URL url)
	{
		eirc.visitURL(url);
    }
}